<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>Nordic Thingy:52 v2.2.0 : Battery measurement</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet_offline.css" rel="stylesheet" type="text/css"/>
<link href="nordic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" width="100%" class="blank">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Nordic Semiconductor" src="nordic_small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Nordic Thingy:52 v2.2.0
   </div>
  </td>
 </tr>
 </tbody>
</table>
<script>
var url=window.location.href.split("/").reverse()[1];
var validLinks= ["nrf5","s130","s132","s212","s332"];
var index;
for (index = 0; index < validLinks.length; ++index) {
   if ( url.indexOf(validLinks[index]) !== -1 ) {
      document.getElementById(validLinks[index]).setAttribute('class', 'doclinks docselected');
   };
};
</script>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__m__batt__meas.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Battery measurement<div class="ingroups"><a class="el" href="group__modules.html">Thingy modules</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Battery measurement module API.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structbatt__meas__init__t.html">batt_meas_init_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Init parameters for m_batt_meas.  <a href="structbatt__meas__init__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structbatt__meas__param__t.html">batt_meas_param_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Input parameters for m_batt_meas.  <a href="structbatt__meas__param__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structm__batt__meas__event__t.html">m_batt_meas_event_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The struct passed to the handler with relevant battery information.  <a href="structm__batt__meas__event__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structstate__of__charge__t.html">state_of_charge_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Struct for providing m_batt_meas with information on converting voltage to state of charge (Remaining battery capacity).  <a href="structstate__of__charge__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structvoltage__divider__t.html">voltage_divider_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Struct for providing m_batt_meas with physical voltage divider information.  <a href="structvoltage__divider__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga3a8f1eaf8376db27cdc7a87946c84c37"><td class="memItemLeft" align="right" valign="top"><a id="ga3a8f1eaf8376db27cdc7a87946c84c37"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__m__batt__meas.html#ga3a8f1eaf8376db27cdc7a87946c84c37">m_batt_meas_event_handler_t</a>) (<a class="el" href="structm__batt__meas__event__t.html">m_batt_meas_event_t</a> const *p_event)</td></tr>
<tr class="memdesc:ga3a8f1eaf8376db27cdc7a87946c84c37"><td class="mdescLeft">&#160;</td><td class="mdescRight">m_batt sensor event handler type. Should be implemented by user e.g. in main.c() <br /></td></tr>
<tr class="separator:ga3a8f1eaf8376db27cdc7a87946c84c37"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga0411cd49bb5b71852cecd93bcbf0ca2d"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <a class="el" href="group__m__batt__meas.html#gga0411cd49bb5b71852cecd93bcbf0ca2dac55c4d013f9842ae8b8a145adcbe4d7e">M_BATT_STATUS_CODE_SUCCESS</a>, 
<a class="el" href="group__m__batt__meas.html#gga0411cd49bb5b71852cecd93bcbf0ca2da1136981cfa14273fe5bd47a316b31ebe">M_BATT_STATUS_CODE_INVALID_PARAM</a>
 }<tr class="memdesc:ga0411cd49bb5b71852cecd93bcbf0ca2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">The m_batt_meas return status codes.  <a href="group__m__batt__meas.html#ga0411cd49bb5b71852cecd93bcbf0ca2d">More...</a><br /></td></tr>
</td></tr>
<tr class="separator:ga0411cd49bb5b71852cecd93bcbf0ca2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga97242e505dbdc2ee7827cc0db746ffca"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__m__batt__meas.html#ga97242e505dbdc2ee7827cc0db746ffca">m_batt_meas_event_type_t</a> { <br />
&#160;&#160;<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaa4ad836450107533f4c095e501705930d">M_BATT_MEAS_EVENT_DATA</a>, 
<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaa174cab8a06de89889f665d06608f9cca">M_BATT_MEAS_EVENT_LOW</a>, 
<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaac213288e1593fe9f62cfb26bf4e63efe">M_BATT_MEAS_EVENT_FULL</a>, 
<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaa1ecb97dce4fbd6d2e90f0c457f93d333">M_BATT_MEAS_EVENT_USB_CONN_CHARGING</a>, 
<br />
&#160;&#160;<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaa35441adf890d9265370bcb429a3bc52b">M_BATT_MEAS_EVENT_USB_CONN_CHARGING_FINISHED</a>, 
<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaa85981536414e45d63d487a6f3f033cb8">M_BATT_MEAS_EVENT_USB_DISCONN</a>, 
<a class="el" href="group__m__batt__meas.html#gga97242e505dbdc2ee7827cc0db746ffcaa15b80e149f891938b19c579c987fc6fe">M_BATT_MEAS_EVENT_ERROR</a>
<br />
 }<tr class="memdesc:ga97242e505dbdc2ee7827cc0db746ffca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Battery and charge event codes.  <a href="group__m__batt__meas.html#ga97242e505dbdc2ee7827cc0db746ffca">More...</a><br /></td></tr>
</td></tr>
<tr class="separator:ga97242e505dbdc2ee7827cc0db746ffca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga36dc9d46d92c054588f99cf2044b1087"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__m__batt__meas.html#ga36dc9d46d92c054588f99cf2044b1087">m_batt_meas_disable</a> (void)</td></tr>
<tr class="memdesc:ga36dc9d46d92c054588f99cf2044b1087"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for stopping the battery measurement.  <a href="#ga36dc9d46d92c054588f99cf2044b1087">More...</a><br /></td></tr>
<tr class="separator:ga36dc9d46d92c054588f99cf2044b1087"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3e17a5ec6e6a7683eb0fdb578ae5388e"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__m__batt__meas.html#ga3e17a5ec6e6a7683eb0fdb578ae5388e">m_batt_meas_enable</a> (uint32_t meas_interval_ms)</td></tr>
<tr class="memdesc:ga3e17a5ec6e6a7683eb0fdb578ae5388e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for enabling battery measurement at the given interval.  <a href="#ga3e17a5ec6e6a7683eb0fdb578ae5388e">More...</a><br /></td></tr>
<tr class="separator:ga3e17a5ec6e6a7683eb0fdb578ae5388e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga822adb8e2120c95c740d244b2bbf4709"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__m__batt__meas.html#ga822adb8e2120c95c740d244b2bbf4709">m_batt_meas_init</a> (<a class="el" href="structm__ble__service__handle__t.html">m_ble_service_handle_t</a> *p_handle, <a class="el" href="structbatt__meas__init__t.html">batt_meas_init_t</a> const *const p_batt_meas_init)</td></tr>
<tr class="memdesc:ga822adb8e2120c95c740d244b2bbf4709"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for initializing the battery driver.  <a href="#ga822adb8e2120c95c740d244b2bbf4709">More...</a><br /></td></tr>
<tr class="separator:ga822adb8e2120c95c740d244b2bbf4709"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Battery measurement module API. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga0411cd49bb5b71852cecd93bcbf0ca2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0411cd49bb5b71852cecd93bcbf0ca2d">&#9670;&nbsp;</a></span>anonymous enum</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The m_batt_meas return status codes. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga0411cd49bb5b71852cecd93bcbf0ca2dac55c4d013f9842ae8b8a145adcbe4d7e"></a>M_BATT_STATUS_CODE_SUCCESS&#160;</td><td class="fielddoc"><p>Successfull. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga0411cd49bb5b71852cecd93bcbf0ca2da1136981cfa14273fe5bd47a316b31ebe"></a>M_BATT_STATUS_CODE_INVALID_PARAM&#160;</td><td class="fielddoc"><p>Invalid parameters. </p>
</td></tr>
</table>

</div>
</div>
<a id="ga97242e505dbdc2ee7827cc0db746ffca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga97242e505dbdc2ee7827cc0db746ffca">&#9670;&nbsp;</a></span>m_batt_meas_event_type_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__m__batt__meas.html#ga97242e505dbdc2ee7827cc0db746ffca">m_batt_meas_event_type_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Battery and charge event codes. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaa4ad836450107533f4c095e501705930d"></a>M_BATT_MEAS_EVENT_DATA&#160;</td><td class="fielddoc"><p>Is called back at the desired frequency. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaa174cab8a06de89889f665d06608f9cca"></a>M_BATT_MEAS_EVENT_LOW&#160;</td><td class="fielddoc"><p>Low battery event (&lt;= set by user). </p>
</td></tr>
<tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaac213288e1593fe9f62cfb26bf4e63efe"></a>M_BATT_MEAS_EVENT_FULL&#160;</td><td class="fielddoc"><p>Full battery event (&gt;= value set by user). </p>
</td></tr>
<tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaa1ecb97dce4fbd6d2e90f0c457f93d333"></a>M_BATT_MEAS_EVENT_USB_CONN_CHARGING&#160;</td><td class="fielddoc"><p>Battery main og tricle charging active. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaa35441adf890d9265370bcb429a3bc52b"></a>M_BATT_MEAS_EVENT_USB_CONN_CHARGING_FINISHED&#160;</td><td class="fielddoc"><p>Battery charging finished/not charging. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaa85981536414e45d63d487a6f3f033cb8"></a>M_BATT_MEAS_EVENT_USB_DISCONN&#160;</td><td class="fielddoc"><p>USB disconnected, battery not charging. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga97242e505dbdc2ee7827cc0db746ffcaa15b80e149f891938b19c579c987fc6fe"></a>M_BATT_MEAS_EVENT_ERROR&#160;</td><td class="fielddoc"><p>Error state detected signalled by the charger (not implemeted, CHG and CHG finished will toggle in case of error). </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga36dc9d46d92c054588f99cf2044b1087"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga36dc9d46d92c054588f99cf2044b1087">&#9670;&nbsp;</a></span>m_batt_meas_disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t m_batt_meas_disable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for stopping the battery measurement. </p>
<dl class="section return"><dt>Returns</dt><dd>M_BATT_STATUS_CODE_SUCCESS </dd>
<dd>
Other codes from the underlying driver. </dd></dl>

</div>
</div>
<a id="ga3e17a5ec6e6a7683eb0fdb578ae5388e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3e17a5ec6e6a7683eb0fdb578ae5388e">&#9670;&nbsp;</a></span>m_batt_meas_enable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t m_batt_meas_enable </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>meas_interval_ms</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for enabling battery measurement at the given interval. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">meas_interval_ms</td><td>Sampling interval given in milliseconds.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This will call the handler supplied in p_batt_meas_init at the given interval which is supplied with a <a class="el" href="structm__batt__meas__event__t.html" title="The struct passed to the handler with relevant battery information. ">m_batt_meas_event_t</a> struct containing the information.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>M_BATT_STATUS_CODE_SUCCESS </dd>
<dd>
Other codes from the underlying driver. </dd></dl>

</div>
</div>
<a id="ga822adb8e2120c95c740d244b2bbf4709"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga822adb8e2120c95c740d244b2bbf4709">&#9670;&nbsp;</a></span>m_batt_meas_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t m_batt_meas_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structm__ble__service__handle__t.html">m_ble_service_handle_t</a> *&#160;</td>
          <td class="paramname"><em>p_handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structbatt__meas__init__t.html">batt_meas_init_t</a> const *const&#160;</td>
          <td class="paramname"><em>p_batt_meas_init</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for initializing the battery driver. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">p_handle</td><td>Pointer to the location to store the service handle. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">p_batt_meas_init</td><td>Struct containing the configuration parameters.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>M_BATT_STATUS_CODE_SUCCESS </dd>
<dd>
M_BATT_STATUS_CODE_INVALID_PARAM </dd>
<dd>
NRF_ERROR_NULL </dd>
<dd>
Other codes from the underlying driver. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="topicfooter">
<a href="mailto:docfeedback@nordicsemi.no?subject=Documentation%20feedback" id="maillink">Documentation feedback</a> | <a href="https://devzone.nordicsemi.com/questions/" target="_blank">Developer Zone</a> | <a href="http://response.nordicsemi.com/subscribe-to-our-newsletters" target="_blank">Subscribe</a> | Updated <span id="date"/>
<script>
var date = new Date("Thu Feb 7 2019" + " UTC");
document.getElementById("date").innerHTML = date.toJSON().slice(0, 10);
var url=window.location.href.split("?")[0];
var filename=url.substring(url.lastIndexOf('/')+1);
document.getElementById("maillink").href = "mailto:docfeedback@nordicsemi.no?subject=Documentation%20feedback"+decodeURIComponent("%26")+"body=File%20name%3A%20"+encodeURIComponent(filename);
</script>
</div>
</body>
</html>
